package com.zzl.bonds.ticket.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.zzl.bonds.ticket.dto.*;
import com.zzl.bonds.ticket.dto.myticket.MyTicketBusinessDetail;
import com.zzl.bonds.ticket.dto.myticket.MyTicketDetail;
import com.zzl.bonds.ticket.entity.TicketEntity;
import com.zzl.bonds.ticket.entity.TicketOpenEntity;
import com.zzl.general.common.exception.SysException;
import com.zzl.general.common.serurity.entity.User;
import com.zzl.general.common.utils.PageUtils;

import java.util.List;
import java.util.Map;

/**
 * 我的票据
 *
 * @author sunpp
 * @date 2022-02-16 11:14:07
 */
@SuppressWarnings("javadoc")
public interface TicketService extends IService<TicketEntity> {


    /**
     * 冻结 或者解冻 凭证
     *
     * @param id   票的id
     * @param user 登录用户
     */
    String frozenTicket(String id, User user);

    /**
     * 平台全部 票据
     *
     * @param params 查询参数
     * @return 分页数据
     */
    PageUtils queryAllPage(Map<String, Object> params) throws SysException;

    /**
     * 开立保存 我的票据
     *
     * @param openEntity 开立实体
     * @param user       登录用户
     */
    String saveTicket(TicketOpenEntity openEntity, User user);

    /**
     * 分页查询
     *
     * @param params 查询参数
     * @return 分页数据
     */
    PageUtils queryPage(Map<String, Object> params, User user) throws SysException;


    /**
     * 转让中 票据
     *
     * @param params 查询参数
     * @return 分页数据
     */
    PageUtils queryTransferIngPage(Map<String, Object> params, User user) throws SysException;

    /**
     * 融资中 票据
     *
     * @param params 查询参数
     * @return 分页数据
     */

    PageUtils queryFinanceIngPage(Map<String, Object> params, User user) throws SysException;


    /**
     * 失效的 票据
     *
     * @param params 查询参数
     * @return 分页数据
     */
    PageUtils queryInvalidIngPage(Map<String, Object> params, User user) throws SysException;

    /**
     * 平台 我的凭证--详情
     *
     * @param id 票id
     * @return
     * @throws SysException 业务异常
     */
    MyTicketDetail getPltMyTicketDetail(String id) throws SysException;


    /**
     * 我的票据--凭证信息
     *
     * @param id id
     * @return
     * @throws SysException 业务异常
     */
    MyTicketDetail getMyTicketDetail(String id) throws SysException;


    /**
     * 我的票据--业务信息
     *
     * @param id id
     * @return
     * @throws SysException 业务异常
     */
    MyTicketBusinessDetail getTicketBusinessDetail(String id) throws SysException;

    /**
     * 新增
     *
     * @param ticketAddDto 新增实体
     * @param user         当前登录用户
     * @throws SysException 业务异常
     */
    void saveTicket(TicketAddDto ticketAddDto, User user) throws SysException;

    /**
     * 修改
     *
     * @param ticketUpdateDto 修改实体
     * @param user            当前登录用户
     * @throws SysException 业务异常
     */
    void updateTicketById(TicketUpdateDto ticketUpdateDto, User user) throws SysException;

    TicketEntity getByTicketNo(String ticketNo);

    /**
     * 兑付分页查询
     *
     * @param params
     * @param user
     * @return
     */
    PageUtils cashingPage(Map<String, Object> params, User user,String advancePaymentStatus) throws SysException;

    /**
     * 获取叶子节点
     *
     * @param ticketOpenId
     * @param user
     * @return
     */
    List<CashTicketPage> getCashList(String ticketOpenId, User user) throws SysException;

    void cashTicket(String ticketOpenId, User user) throws SysException;

    void executeWaitingPayment(Integer days);

    List<CashTicketPage>  getPlatformCashList(String ticketOpenId, User user) throws SysException;

    void approvalCashing(CashTicketUpdateDto cashTicketUpdateDto, User user) throws SysException;

    void approvalCashingReject(CashTicketUpdateDto cashTicketUpdateDto, User user) throws SysException;

    /**
     * 根据开立申请id新增我的票据
     *
     * @param ticketOpenId 开立申请id
     * @param user         登录用户
     * @throws SysException 业务异常
     */
    String saveTicketByOpenId(String ticketOpenId, User user) throws SysException;

    SurveyInfo survey(User user)throws SysException;

}

